package dr.joketalker.controller;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RatingBar;
import android.widget.TextView;
import dr.joketalker.R;
import dr.joketalker.dao.FactoryDAO;
import dr.joketalker.dao.UserDAO;
import dr.joketalker.entity.User;
import dr.joketalker.model.ProfilModel;
public class ProfilController extends MyController{


	protected Button btnJokes;
	protected Button btnSave;


	protected TextView tvPoints;
	protected EditText etName;
	protected EditText etDescription;
	
	protected RatingBar rbExp;
	

	protected UserDAO userDao = FactoryDAO.getUserDao();
	
	
	protected ProfilModel mModel = new ProfilModel();
	
	protected User user;
	
	 @Override
	public void onCreate(Bundle savedInstanceState) {
	 
	        super.onCreate(savedInstanceState);
	        setContentView(R.layout.profil);
	        
	        btnJokes 		= (Button)findViewById(R.id.btnJokes);
	        btnSave 		= (Button)findViewById(R.id.btnSave);
	        
	    	tvPoints		= (TextView)findViewById(R.id.tvTitle);
	    	
	    	etName			= (EditText)findViewById(R.id.etName);
	    	etDescription	= (EditText)findViewById(R.id.etDescription);

	    	
	    	rbExp 			= (RatingBar)findViewById(R.id.rbExp);

   	
	    	
	        btnJokes.setOnClickListener(this);
	        btnSave.setOnClickListener(this);

	        
	        Intent intent = getIntent();
	        this.user = (User)intent.getSerializableExtra("USER");

	        init(user);	        
	 }


	 public void init(User user){
		 this.user 		= user;
		 tvPoints		.setText(Float.toString(user.getExp()));
		 etName		.setText(user.getName());
		 etDescription		.setText(user.getDescription());
		 rbExp.setRating(user.getExp());
	 }
	 
	@Override
	public void onClick(View v) {
		super.onClick(v);
		
		if(btnJokes.equals(v)){

		}else if(btnSave.equals(v)){
			
		}
	}
	

	
}
